package com.study.userserviceprovider.controller;


import com.study.userserviceprovider.hystix.UserHsytixCommand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class HystrixCommandController {

    @Autowired
    private RestTemplate restTemplate;


    @GetMapping("/hystrix/command/{num}")
    public String hystrix(@PathVariable("num") int num){
        UserHsytixCommand userHsytixCommand = new UserHsytixCommand(num,restTemplate);
        return userHsytixCommand.execute();
    }

}
